<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">


<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="assets/images/favicon.png" type="image/png">
    <title>Home</title>


    <link href="assets/plugins/morris-chart/morris.css" rel="stylesheet">
    <link href="assets/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet"/>
    <link href="assets/css/icons.css" rel="stylesheet">
    <link href="assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/responsive.css" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/mycss.css">
    <link rel="stylesheet" href="assets/layui/css/layui.css">
    <link href="assets/css/pagination.css" rel="stylesheet">

</head>

<body class="sticky-header">


<!--开始左边的菜单栏-->
<div class="left-side sticky-left-side">

    <!--上方的logo-->
    <div class="logo">
        <a href="index.html"><img src="assets/images/logo.png" alt=""></a>
    </div>

    <div class="logo-icon text-center">
        <a href="index.html"><img src="assets/images/logo-icon.png" alt=""></a>
    </div>
    <!--logo-->
    <div class="left-side-inner">
        <!--Sidebar nav-->
        <ul class="nav nav-pills nav-stacked custom-nav">
            <li class="menu-list"><a href="preIndex.html"><i class="icon-home"></i> <span>后台管理</span></a>
                <ul class="sub-menu-list">
                    <li class="active"><a href="preIndex.html">后台首页</a></li>
                </ul>
            </li>
            <li class="menu-list "><a href="index.html"><i class="icon-home"></i> <span>资讯管理</span></a>
                <ul class="sub-menu-list">
                    <li class="active"><a href="index.html">查看当前资讯</a></li>
                    <li><a href="modify_information.html">修改资讯</a></li>
                </ul>
            </li>

            <li class="menu-list "><a href="#"><i class="icon-layers"></i> <span>风景名胜管理</span></a>
                <ul class="sub-menu-list">
                    <li><a href="show_famous_scenery.html">查看现有的风景名胜</a></li>
                    <li><a href="modify_famous_scenery.html">修改风景名胜</a></li>
                </ul>
            </li>

            <li class="menu-list"><a href="#"><i class="icon-grid"></i> <span>美食管理</span></a>
                <ul class="sub-menu-list">
                    <li><a href="show_delicious_food.html">查看现有的美食</a></li>
                    <li><a href="modify_delicious_food.html">修改美食信息</a></li>
                </ul>
            </li>

            <li class="menu-list "><a href="#"><i class="icon-envelope-open"></i> <span>旅游路线管理</span></a>
                <ul class="sub-menu-list">
                    <li><a href="show_now_route.html">查看现有的路线</a></li>
                    <li><a href="modify_route.html">修改路线</a></li>
                </ul>
            </li>

            <li class="menu-list nav-active"><a href="#"><i class="icon-loop"></i> <span>酒店的管理</span></a>
                <ul class="sub-menu-list">
                    <li><a href="show_now_hotel.html">查看现有的酒店</a></li>
                    <li><a href="modify_now_hotel.html">查看所有酒店的全部订单</a></li>
                    <li><a href="form-wizard.html">查看全部酒店的房源信息</a></li>
                </ul>
            </li>


            <li class="menu-list "><a href="#"><i class="icon-film"></i> <span>用户管理</span></a>
                <ul class="sub-menu-list">
                    <li><a href="show_user.html">查看所有的用户</a></li>
                    <li><a href="add_user.html">增加用户</a></li>
                </ul>
            </li>


            <li class="menu-list"><a href="#"><i class="icon-lock"></i> <span>账户信息</span></a>
                <ul class="sub-menu-list">
                    <li><a href="admin_information.html"> 查看信息 </a></li>
                    <li><a href="forgot-password.html"> 修改密码 </a></li>
                </ul>
            </li>

            <li><a href="calendar.html"><i class="icon-note"></i> <span>网站首页</span></a></li>
            <li><a href="http://www.pzhu.edu.cn/"><i class="icon-wrench"></i> <span>攀枝花简介</span></a></li>

        </ul>
        <!--侧边栏结束-->

    </div>
</div>
<!--End left side menu-->

<!-- 中间面板开始-->
<div class="main-content">

    <!-- 中间头部开始-->
    <div class="header-section">

        <!--控制侧边栏的伸缩状态-->
        <a class="toggle-btn"><i class="fa fa-bars"></i></a>


        <div th:replace="preIndex :: userAdminInfo">

        </div>

    </div>
    <!--头部分结束-->


    <!--中间包装部分开始-->
    <div class="wrapper">

        <!--中间部分的标题-->
        <div class="page-title-box">
            <h4 class="page-title">酒店管理</h4>
            <ol class="breadcrumb">
                <li>
                    <a href="#">酒店管理</a>
                </li>

                <li class="active">
                    <a href="#">查看现有的酒店</a>
                </li>
            </ol>
            <div class="clearfix"></div>
        </div>
        <!--中间部分的标题结束-->
        <!--Start row-->
        <div class="row">
            <div class="col-md-12">
                <div class="white-box">
                    <h2 class="header-title">酒店的信息</h2>
                    <input type="text" name="keyword" id="myInputSearch" placeholder="请输入搜索的内容。。"/>
                    <button type="button" id="mySearchBtn" class="layui-btn">搜索</button>
                    <button type="button" id="myFlashBtn" class="layui-btn layui-btn-warm">刷新</button>
                    <div class="table-responsive">
                        <table class="layui-table" lay-size="sm">
                            <colgroup>
                                <col width="150">
                                <col width="200">
                                <col>
                            </colgroup>
                            <thead>
                            <tr>
                                <th style="text-align:center">酒店的ID</th>
                                <th style="text-align:center">酒店的名称</th>
                                <th style="text-align:center">酒店的地址</th>
                                <th style="text-align:center">酒店的电话</th>
                                <th style="text-align:center">酒店的评分</th>
                                <th style="text-align:center">酒店的所属分类</th>
                                <th style="text-align:center">操作</th>
                            </tr>
                            </thead>
                            <tbody id="hotelPageBody">

                            </tbody>

                            <tfoot>
                            <tr>
                                <td colspan="7" align="center">
                                    <button type="button" id="addHotelClassfi" class="layui-btn layui-btn-lg">
                                        增加酒店分类
                                    </button>
                                    <a type="button" href="add_hotel.html"
                                       class="layui-btn layui-btn-lg">增加酒店</a>
                                    <div id="Pagination" class="pagination" style="float: right"><!-- 这里显示分页 --></div>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <!--End row-->

    </div>
    <!-- End Wrapper-->

    <!--//这里应该还需要一个分页的按键-->

    <!--Start  Footer -->
    <footer class="footer-main">Copyright &copy; 2018.Company name All rights reserved.<a target="_blank"
                                                                                          href="http://sc.chinaz.com/moban/">攀枝花学院</a>
    </footer>
    <!--End footer -->

    <!-- 模态框（Modal） -->
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close closeSkuInfo" data-dismiss="modal" aria-hidden="true">&times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel" style="padding: 10px">添加酒店详细信息</h4>
                    <form class="layui-form" action="">
                        <input type="hidden" id="spuId">
                        <div class="layui-form-item">
                            <label class="layui-form-label">房间名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" id="skuName" lay-verify="required" placeholder="请输入名称"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">房间价格</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" id="skuCast" lay-verify="required" placeholder="请输入价格"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>


                        <!-- 单值属性-->
                        <div id="mySaleAttrList">

                        </div>

                        <!--多值属性，注意后缀，多了个s-->
                        <div id="mySaleAttrLists">


                        </div>
                    </form>
                    <div class="layui-btn-group" style="float: right">
                        <button type="button" class="layui-btn" id="addSkuInfo">确认添加
                        </button>
                        <button type="button" class="layui-btn closeSkuInfo" data-dismiss="modal" aria-hidden="true">
                            取消
                        </button>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>


    <div class="modal fade" id="myModa2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="closdMadalBtn">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabe2">增加酒店分类</h4>
                </div>
                <div class="modal-body">
                    <table class="display table">
                        <thead>
                        <tr>
                            <th style="text-align:center">分类名称</th>
                            <th style="text-align:center">操作状态</th>
                        </tr>
                        </thead>
                        <tbody id="classificationTableBody">

                        </tbody>
                    </table>
                    <div style="text-align:center">
                        <button type="button" class="btn btn-success round btn-add" id="addClassificationBtn">增加分类
                        </button>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModa3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                            id="deleteClosdMadalBtn">&times;
                    </button>
                    <h4 class="modal-title" id="myModalLabe3">确认删除</h4>
                </div>
                <div class="modal-body">
                    <div class="page-header">
                        <h1 id="deleteClassifitionName" style="text-align: center"></h1>
                    </div>
                    <button type="button" class="btn btn-danger round btn-add" id="deleteClassificationBtn">确认删除
                    </button>
                    <button type="button" class="btn btn-success round btn-add" id="NodeleteClassificationBtn"
                            data-dismiss="modal" aria-hidden="true">取消
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

</div>
<!--End main content -->

<!--Begin core plugin -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/plugins/moment/moment.js"></script>
<script src="assets/js/jquery.slimscroll.js "></script>
<script src="assets/js/jquery.nicescroll.js"></script>
<script src="assets/js/functions.js"></script>

<script src="assets/layui/layui.js"></script>
<script src="assets/js/jquery.pagination.js"></script>


<script>

    //储存照片的全局变量；
    window.imags = [];

    //保存多值属性！！
    window.attrNums = [];

    //自定义js系统中的函数;
    //增加js库中数组的默认元素。
    Array.prototype.indexOf = function(val) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] == val) return i;
        }
        return -1;
    };

    Array.prototype.remove = function(val) {
        var index = this.indexOf(val);
        if (index > -1) {
            this.splice(index, 1);
        }
    };

    //Demo
    layui.use('form', function () {
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function (data) {
            layer.msg(JSON.stringify(data.field));
            return false;
        });


    });



    // 进行异步获取数据
    $(function () {
        //1.初始化变量
        window.pageNo = 1;
        window.keyword = "";
        //2.调用函数实现Ajax分页
        generateHotelPage();

        //给搜索按钮绑定单击响应函数；
        $("#mySearchBtn").click(function () {
            // layer.msg("SDfsdfsdf");
            //  alert("dsfsdfds");
            var searchText = $("#myInputSearch").val();
            console.log();
            if (searchText == "") {
                layer.msg("请输入搜索的字符！")
                return;
            }
            ;
            window.keyword = searchText;
            generateHotelPage();
        });

        // 给刷新按钮绑定单击响应函数
        $("#myFlashBtn").click(function () {
            $("#mySearchBtn").val("");
            window.keyword = "";
            window.pageNo = 1;
            generateHotelPage();
        });

        $("#addHotelClassfi").click(function () {
            refreshMedel2();
        })

        $("#addClassificationBtn").click(function () {
            //弹出对话框，并输入分类信息；
            var classificationName = prompt("请输入分类的信息: ");
            //进行异步更新;
            console.log(classificationName);
            //发送异步请求，获取所有的分类信息；
            if (classificationName == "" || classificationName == null) {// 如果取消输入则会返回null
                return;
            }
            $.ajax({
                "url": "sava/hotel/classification",
                "type": "post",
                "contentType": "application/x-www-form-urlencoded",
                "data": {
                    "classificationName": classificationName
                },
                // 预期服务器返回的数据
                "dataType": "json",
                "error": function (response) {
                    var message = response.responseJSON.message;
                    layer.msg(message);
                },
                "success": function (response) {
                    layer.msg(response.message);
                    refreshMedel2();
                }
            });
        });

        $(".closeSkuInfo").click(function () {
            $("#mySaleAttrList").empty();
            $("#mySaleAttrLists").empty();
        });

        $("#addSkuInfo").click(function () {
            var spuId  = $("#spuId").val();
            var skuName = $("#skuName").val();
            if (skuName == ""){
                layer.msg("请输入房间名称！");
                return;
            }
            var skuCast = $("#skuCast").val();
            var reg = /^[0-9]*$/;
            if (!reg.test(skuCast)||"" == skuCast) {
                layer.msg("请输入正确的价格！");
                return;
            }

            var selects = $("#mySaleAttrList select");

            var attrList = [];
            $.each(selects, function (index, value) {
                //我们可以定义一个数组进行保存
                //这里获得了属性的id和对应选中值的id；等会考虑怎么存
                // console.log($(value).attr("id"));
                // console.log($(value).find("option:selected").attr("num"));
                // 反正属性的个数基本不变，我们就用这种方式，下标为1，就代表第一个属性，值就代表选中的属性的值，本爸爸就是个天才；
                attrList[$(value).attr("id")] = $(value).find("option:selected").attr("num");
            });
            // //多值属性很难搞呀;
            // var numSelects = $("#mySaleAttrLists .attrNameValueDiv");
            // $.each(numSelects,function (index,value) {
            // console.log($(this).find("div.layui-form-checked").find("span").val());
            // });


            // var arr = [];
            // $("input:checkbox[name='+其他+']:checked").each(function (i) {
            //     arr[i] = $(this).val();
            //     console.log(arr[i]);
            // });
            //发送ajax请求数据；
            $.ajax({
                "url": "sava/hotel/item/sku",
                "type": "post",
                "data":{
                    "spuId":spuId,
                    "skuName":skuName,
                    "skuCast":skuCast,
                    "attrList":attrList,
                    "attrNums":attrNums
                },
                "dataType": "json",
                "traditional": true,
                "error": function (response) {
                    layer.msg("服务器错误，请联系管理员！");
                },
                "success": function (response) {
                    attrNums = [];
                    layer.msg(response.message);
                    $("#myModal").modal("hide");
                }
            });

        });
    });

    function refreshMedel2() {
        //发送异步请求，获取所有的分类信息；
        $.ajax({
            "url": "get/all/hotel/classification",
            "type": "post",
            "contentType": "application/x-www-form-urlencoded",
            // 预期服务器返回的数据
            "dataType": "json",
            "error": function (response) {
                var message = response.responseJSON.message;
                layer.msg(message);
            },
            "success": function (response) {
                $("#classificationTableBody").empty();
                var date = response.data;
                //给模态框进行填充值；
                $.each(date, function (index, value) {
                    // 进行拼接
                    var classificationId = value.id;
                    var categorizationInformationName = value.categorizationInformation;
                    var html = "<tr><td style='text-align:center'>" + categorizationInformationName + "</td><td style='text-align:center'><button type='button' class='btn btn-danger btn-myClass deleteBtn1' name = " + categorizationInformationName + " num=" + classificationId + ">删除</button></tr>";
                    $("#classificationTableBody").append(html);
                    $("#myModa2").modal("show");
                    //给删除按钮绑定单击响应函数；
                });
                bindDeleteClassification();
            }
        });
    }

    function bindDeleteClassification() {
        $(".deleteBtn1").click(function () {
            var classificationName = $(this).attr("name");
            var classificationId = $(this).attr("num");
            $("#deleteClassifitionName").text(classificationName);
            $("#deleteClassificationBtn").attr("num", classificationId);
            $("#myModa3").modal("show");
        })
    }

    function generateHotelPage() {
        //发送请求，获得数据
        $.ajax({
            "url": "get/hotel/item/page",
            "type": "post",
            "data": {
                "pageNo": window.pageNo,
                "keyword": window.keyword
            },
            "contentType": "application/x-www-form-urlencoded",
            // 预期服务器返回的数据
            "dataType": "json",
            "error": function (response) {
                var message = response.responseJSON.message;
                layer.msg(message);
            },
            "success": function (response) {

                //获取分页数据
                var pageInfo = response.data;

                //生成表格数据,因为是异步请求,所以生成表格的代码必须写在success的回调函数中;
                generateHotelTable(pageInfo);

                //初始化页码导航条
                generateNavigator(pageInfo);
            }
        });

    }

    //生成表格数据
    function generateHotelTable(pageInfo) {
        //清除旧的数据
        $("#hotelPageBody").empty();

        //获取list属性对应的数据
        var list = pageInfo.list;

        console.log(list);

        //检测list是否包含有效数据
        if (list == null || list.length == 0) {
            $("#hotelPageBody").append("<tr><td style='text-align:center; font-size: 16px' colspan='7'>抱歉！为查询到任何匹配的数据！</td></tr>");
            return;
        }

        //遍历list,从data中获取数据
        for (var i = 0; i < list.length; i++) {
            var hotelItem = list[i];
            var id = hotelItem.id;
            var hotelItemSpuAdress = hotelItem.hotelItemSpuAdress;
            var hotelItemSpuTel = hotelItem.hotelItemSpuTel;
            var hotelItemSpuScore = hotelItem.hotelItemSpuScore;
            var hotelItemSpuName = hotelItem.hotelItemSpuName;
            var categorizationInformationName = hotelItem.categorizationInformationName;
            var imags = hotelItem.imags;
            //定义临时储存的容器；
            var imageUrl = "";
            if (imags.length > 0) {
                imageUrl = imags[0].hotelItemImagUrl;
            } else {
            }
            // window.images = imags;
            //使用元素动态进行绑定；
            var trHTML = "<tr><td style='text-align:center'>" + (i + 1) + "</td><td style='text-align:center' ><a href='#'>" + hotelItemSpuName +
                "</a></td><td style='text-align:center' >" + hotelItemSpuAdress + "</td><td style='text-align:center' >" + hotelItemSpuTel +
                "</td><td style='text-align:center' >" + hotelItemSpuScore + "</td><td style='text-align:center' >" + categorizationInformationName +
                "</td><td style='text-align:center'>" +
                "<div class='layui-btn-group'><button type='button' class='layui-btn swithImage' num = " + imageUrl + ">查看大图</button><button type='button' class='layui-btn addHotelSku' itemId=" + id + ">添加房型</button><a href='update_hotel?itemId=" + id + "' type='button' class='layui-btn'>编辑</a><button type='button' num = " + id + " class='layui-btn deleteBtn'>删除</button></div></td></tr>";
            $("#hotelPageBody").append(trHTML);
        }
        bingBtn();
    }


    function bingBtn() {
        layui.use('layer', function () {
            var layer = layui.layer;
            $('.swithImage').on('click', function () {
                var imgUrl = $(this).attr("num");
                if (imgUrl == "") {
                    imgUrl = "http://192.168.153.250/group1/M00/00/00/wKiZ-l38HvaATpvFAEYxkmJKswM191.jpg";
                }
                layer.open({
                    type: 1,
                    area: ['1200px', '720px'],
                    shadeClose: true, //点击遮罩关闭
                    content: "<img src=" + imgUrl + " width='1200px' height='680px'>"
                });
            });

            $(".deleteBtn").on('click', function () {
                var id = $(this).attr("num");
                layer.open({
                    content: '<h2 style="text-align: center; font-family: 楷体">确认删除吗？</h2>'
                    , btn: ['确认删除', '取消']
                    , yes: function (index, layero) {
                        //按钮【按钮一】的回调，调用函数进行删除
                        deleteHotelById(id);
                        return false;
                    },
                    btn2: function (index, layero) {
                        //直接进行关闭
                    }
                    , cancel: function () {
                        //右上角关闭回调
                        // layer.msg("点击了关闭按钮！");
                        // return false;// 开启该代码可禁止点击该按钮关闭
                    }
                });
            });

            $(".addHotelSku").click(function () {
                //获取spuid，进行赋值，以便后面进行skuInfo的保存
                $("#spuId").val($(this).attr("itemId"));
                //发送ajax请求，获取属性和属性值，使用多重循环，进行页面的展示。
                $.post("/get/all/sale/attr", function (response) {
                    var saleAttrs = response.data;
                    $.each(saleAttrs, function (index, value) {
                        var saleAttrName = value.saleAttrName;
                        //要进行多选框和单选框的判断,注意，父节点的id是id属性，子节点的id是num属性，没得办法，id不能重复;
                        if (saleAttrName != "其他") {
                            var saleAttrNameId = value.id;
                            var saleAttrNameHtml = "<div class='layui-form-item'><label class='layui-form-label'>" + saleAttrName + "</label><div class='layui-input-block'><select  id= " + saleAttrNameId + "></select></div></div>"
                            $("#mySaleAttrList").append(saleAttrNameHtml);
                            var hotelSaleAttrValues = value.hotelSaleAttrValues;
                            $.each(hotelSaleAttrValues, function (index2, value2) {
                                var hotelSaleAttrId = value2.id;
                                var hotelSaleAttrValue = value2.hotelSaleAttrValue;
                                var hotelSaleAttrValueHtml = "<option num = " + hotelSaleAttrId + ">" + hotelSaleAttrValue + "</option>"
                                $("#" + saleAttrNameId + "").append(hotelSaleAttrValueHtml)
                            });
                        } else {
                            var saleAttrNameId = value.id;
                            var saleAttrNameHtml = "<div class='layui-form-item'><label class='layui-form-label'>" + saleAttrName + "</label><div class='layui-input-block attrNameValueDiv' id=" + saleAttrNameId + "></div></div>"
                            $("#mySaleAttrLists").append(saleAttrNameHtml);
                            var hotelSaleAttrValues = value.hotelSaleAttrValues;
                            $.each(hotelSaleAttrValues, function (index2, value2) {
                                var hotelSaleAttrId = value2.hotelSaleAttrId;
                                var hotelSaleAttrValue = value2.hotelSaleAttrValue;
                                var hotelSaleAttrValueHtml = "<input type='checkbox' lay-filter="+saleAttrName+" value = "+hotelSaleAttrValue+" num = " + hotelSaleAttrId + " title=" + hotelSaleAttrValue + ">"
                                $("#" + saleAttrNameId + "").append(hotelSaleAttrValueHtml)
                            });
                        }
                    });
                    $("#myModal").modal("show");
                    //动态添加的元素，是不会进行渲染的，这里就需要使用到这个官方的工具；
                    layui.use('form', function () {
                        var form = layui.form;
                        form.render('select');
                        form.render('checkbox');
                    });

                    //动态添加的元素，是不会进行渲染的，这里就需要使用到这个官方的工具；
                    layui.use('form', function () {
                        var form = layui.form;
                        //在checkBox里面的是过滤条件，相当与lay-filter="+saleAttrName+"，在input = ‘checkBox中必须要进行设置’;
                        form.on('checkbox(其他)', function (data) {
                            //如果是true，就进行添加，如果是false，就进行删除！！！;
                            //多选的东西已经在attrNums的数组里面了；
                            if (data.elem.checked){
                                attrNums.push(data.elem.value);
                            }else {
                                attrNums.remove(data.elem.value)
                            }
                            // var selectData = data.elem;
                            // console.log(selectData.value);
                            //进行打印测试；
                            // console.log("开始了打印测试！");
                            // for (var i = 0 ; i < attrNums.length ; i++){
                            //     console.log(attrNums[i]);
                            // }
                        });
                    });
                });
            });
        });
    }

    function deleteHotelById(hotelId) {
        $.post("delete/hotelItem", {"hotelItemId": hotelId}, function (response) {
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.msg(response.message);
                generateHotelPage();
            });
        })
    }

    function generateNavigator(pageInfo) {

        // 获取分页总记录数
        var totalRecordNo = pageInfo.total;

        // 创建分页
        $("#Pagination").pagination(totalRecordNo, {
            num_edge_entries: 3, 				//边缘页数
            num_display_entries: 4, 			//主体页数
            callback: pageSelectCallback,		//点击具体页码时调用这个函数
            items_per_page: pageInfo.pageSize, 	//每页显示1项
            current_page: (pageInfo.pageNum - 1),	//当前页索引，需要将pageInfo.pageNum-1才是合适的值
            prev_text: "上一页",					//上一页按钮的文本
            next_text: "下一页",					//下一页按钮的文本
        });
    }

    function pageSelectCallback(page_index, jq) {

        //page_index+1等于要前往的页面的页码
        window.pageNo = page_index + 1;

        //调用分页函数
        generateHotelPage();

        return false;
    }
</script>


</body>


</html>
